<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:65:"D:\phpStudy\WWW\xydh/application/manage\view\advantage\index.html";i:1522379897;}*/ ?>
<!DOCTYPE html>
<html>
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>鑫源东恒后台管理系统</title>
    <link rel="shortcut icon" href="/public/favicon.ico">
    <link href="__MANAGE__/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="__MANAGE__/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="__MANAGE__/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="__MANAGE__/css/animate.min.css" rel="stylesheet">
    <link href="__MANAGE__/css/style.min862f.css?v=4.1.0" rel="stylesheet">
    <link href="__MANAGE__/layui/css/layui.css" rel="stylesheet">

</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeIn">
        <div class="row">
            <div class="col-sm-12">
                <div class="tabs-container">
                    <ul class="nav nav-tabs">
                        <li class="<?php if(input('tab',1) == 1): ?>active<?php endif; ?>"><a data-toggle="tab" href="#tab-1" aria-expanded="true">产品列表</a>
                        </li>
                        <li class="<?php if(input('tab',1) == 2): ?>active<?php endif; ?>"><a data-toggle="tab" href="#tab-2" aria-expanded="false">添加产品</a>
                        </li>
                        <li id="showtab" class="<?php if(input('tab',1) == 3): ?>active<?php endif; ?>"><a data-toggle="tab" href="#tab-3" aria-expanded="false"
                          style="<?php if(input('tab',1) != 3): ?>display:none;<?php endif; ?>">编辑产品</a>
                        </li>
                    </ul>
                    <div class="tab-content">
                        <div id="tab-1" class="tab-pane <?php if(input('tab',1) == 1): ?>active<?php endif; ?>">
                            <div class="panel-body">
                              <form method="post" class="form-horizontal" action="<?php echo url('advantage/index'); ?>"
                              data-type="ajax">
                                <input type="hidden" name="tab" value="1">
                                <div class="row">
                                    <div class="col-sm-12">
                                        <div class="ibox float-e-margins">
                                            <div class="ibox-content">
                                                <div class="table-responsive">
                                                    <table class="table table-striped">
                                                        <thead>
                                                            <tr>
                                                                <th width="10%">ID</th>
                                                                <th width="20%">名称</th>
                                                                <th width="20%">描述</th>
                                                                <th width="20%">缩略图</th>
                                                                <th width="10%">操作</th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                          <?php if(is_array($advantage) || $advantage instanceof \think\Collection || $advantage instanceof \think\Paginator): $i = 0; $__LIST__ = $advantage;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
                                                            <tr>
                                                               <td><?php echo $vo['id']; ?></td>
                                                                <td><?php echo $vo['title']; ?></td>
                                                                <td><?php echo $vo['contents']; ?></td>
                                                                <td><?php if($vo['thumb'] != null): ?><img src="<?php echo $vo['thumb']; ?>" style=" width: 36%"><?php endif; ?></td>
                                                                <td>
                                                                  <a href="<?php echo url('index',['tab'=>3,'id'=>$vo['id']]); ?>" title="编辑">
                                                                      <button type="button" class="btn btn-info" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="管理">
                                                                          <i class="fa fa-edit"></i>
                                                                      </button>
                                                                  </a>&nbsp;&nbsp;
                                                                  <a name="delete" href="<?php echo url('delete',['id'=>$vo['id']]); ?>" title="删除">
                                                                      <button type="button" class="btn btn-danger" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="删除">
                                                                          <i class="fa fa-trash-o "></i>
                                                                      </button>
                                                                  </a>
                                                                </td>
                                                            </tr>
                                                          <?php endforeach; endif; else: echo "" ;endif; ?>
                                                        </tbody>
                                                    </table>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                              </form>
                            </div>
                        </div>
                        <div id="tab-2" class="tab-pane <?php if(input('tab',1) == 2): ?>active<?php endif; ?>">
                          <div class="panel-body">
                            <form method="post" class="form-horizontal" action="<?php echo url('advantage/add'); ?>"
                            data-type="ajax">
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label">名称</label>
                                <div class="col-sm-10">
                                    <input type="text" name="title" class="form-control" value="">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label">描述</label>
                                <div class="col-sm-10">
                                    <input type="text" name="contents" class="form-control" value="">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label">缩略图</label>
                                <div class="col-sm-10">
                                    <input name="thumb" id="thumbnail" type="hidden"/>
                                    <div class="form-inline" >
                                        <div id="sm" class="face_pic ">
                                            <!--<img width="36%" class="img-responsive" src="<?php echo $site['sitelogo']; ?>"/>-->
                                        </div>
                                        <div class="col-sm-12" style="margin-top: 24px;">
                                            <button type="button" class="layui-btn imgBtn" id="test1">
                                                <i class="layui-icon">&#xe67c;</i>上传
                                            </button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <div class="col-sm-4 col-sm-offset-1">
                                    <a href="#" class="btn btn-primary" onclick="javascript:history.back(-1);">返回</a>
                                    <button class="btn btn-primary" type="submit">提交</button>
                                </div>
                            </div>
                          </form>
                          </div>
                        </div>
                        <div id="tab-3" class="tab-pane <?php if(input('tab',1) == 3): ?>active<?php endif; ?>">
                          <div class="panel-body">
                            <form method="post" class="form-horizontal" action="<?php echo url('advantage/edit'); ?>"
                            data-type="ajax">
                            <input type="hidden" name="id" value="<?php echo $advantage_info['id']; ?>">
                            <div class="form-group">
                                <label class="col-sm-1 control-label">名称</label>

                                <div class="col-sm-10">
                                    <input type="text" name="title" class="form-control" value="<?php echo $advantage_info['title']; ?>">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label">描述</label>

                                <div class="col-sm-10">
                                    <input type="text" name="contents" class="form-control" value="<?php echo $advantage_info['contents']; ?>">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label">缩略图</label>
                                <div class="col-sm-10">
                                    <input name="thumb" id="thumbnail2" type="hidden" value="<?php echo $advantage_info['thumb']; ?>"/>
                                    <div class="form-inline" >
                                        <div id="sm2" class="face_pic ">
                                            <img width="36%" class="img-responsive" src="<?php echo $advantage_info['thumb']; ?>"/>
                                        </div>
                                        <div class="col-sm-12" style="margin-top: 24px;">
                                            <button type="button" class="layui-btn imgBtn" id="test2">
                                                <i class="layui-icon">&#xe67c;</i>上传
                                            </button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <div class="col-sm-4 col-sm-offset-1">
                                    <a href="#" class="btn btn-primary" onclick="javascript:history.back(-1);">返回</a>
                                    <button class="btn btn-primary" type="submit">提交</button>
                                </div>
                            </div>
                          </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="__MANAGE__/js/jquery.min.js?v=2.1.4"></script>
    <script src="__MANAGE__/js/bootstrap.min.js?v=3.3.6"></script>
    <script src="__MANAGE__/js/content.min.js?v=1.0.0"></script>
    <script src="__MANAGE__/js/plugins/iCheck/icheck.min.js"></script>
    <script>
        $(document).ready(function(){$(".i-checks").iCheck({checkboxClass:"icheckbox_square-green",radioClass:"iradio_square-green",})});
        $(function () { $("[data-toggle='tooltip']").tooltip(); });
    </script>
    <script src="__MANAGE__/js/plugins/layer/layer.min.js"></script>
    <script src="__MANAGE__/js/layer_alert.js"></script>
    <script src="__MANAGE__/layui/layui.js" charset="utf-8"></script>
    <script>
        $(document).ready(function () {
            // 上传图片
            layui.use('upload', function () {
                var upload = layui.upload;
                //执行实例
                var uploadInst = upload.render({
                    elem: '#test1,#test2' //绑定元素
                    , url: "<?php echo url('config/uploadImg'); ?>" //上传接口
                    , done: function (res) {
                        //上传完毕回调
                        $("#thumbnail").val(res.src);
                        $("#sm").html('<img class="img-responsive" src="' + res.src + '" style="width:30%"/>');
                        $("#thumbnail2").val(res.src);
                        $("#sm2").html('<img class="img-responsive" src="' + res.src + '" style="width:30%"/>');
                    }
                    , error: function () {
                        alert(1);
                        //请求异常回调
                    }
                });
            });
        });
    </script>
</body>
</html>
